import React, { useEffect, useState } from 'react'

export default function App2() {
  const [count, setCount] = useState(0)
  const [isHot, setIsHot] = useState(true)
  useEffect(()=>{
    console.log('执行了');
    return ()=>{
      console.log('count卸载了'+count);
    }
  },[count])
  useEffect(()=>{
    console.log('执行了');
  },[isHot])
  return (
    <div>
      <h1>累加的值{count}</h1>
      <button onClick={()=>{setCount(count+1)}}>+</button>
      <hr />
      <h1>今天的天气真{isHot?'热':'冷'}</h1>
      <button onClick={()=>{setIsHot(!isHot)}}>按钮</button>
    </div>
  )
}
